<?php

namespace tbollmeier\kakuromaster;

function autoload($className) 
{
    $ns = str_replace('\\', '\\\\', __NAMESPACE__);
    $pattern = '/' . $ns . '\\\\(.*)/';
    preg_match($pattern, $className, $matches);
    if ($matches) {
        $basePath = __DIR__;
        $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $matches[1]);
        $path = $basePath.DIRECTORY_SEPARATOR.$subPath.'.php';
        require_once($path);
    }
}
spl_autoload_register(__NAMESPACE__.'\autoload');